﻿@using Nop.Core;
@using Nop.Core.Domain
@using Nop.Core.Infrastructure
@using Nop.Web.Framework.Themes
@using Nop.Web.Framework.UI
@{
    var supportRtl = EngineContext.Current.Resolve<IWorkContext>().WorkingLanguage.Rtl;
    var supportResponsive = EngineContext.Current.Resolve<StoreInformationSettings>().ResponsiveDesignSupported;
    var themeName = EngineContext.Current.Resolve<IThemeContext>().WorkingThemeName;
    
    //we do not support responsive for RTL yet
    if (supportRtl)
    {
        supportResponsive = false;
    }
    //add browser specific CSS files
    var browser = Request.Browser;
    if (browser.Browser == "IE" && browser.MajorVersion == 6)
    {
        Html.AppendCssFileParts(string.Format("~/Themes/{0}/Content/ie6.css", themeName));
    }
    else if (browser.Browser == "IE" && browser.MajorVersion == 7)
    {
        Html.AppendCssFileParts(string.Format("~/Themes/{0}/Content/ie7.css", themeName));
    }
    //responsive design
    if (supportResponsive)
    {
        Html.AppendCssFileParts(string.Format("~/Themes/{0}/Content/responsive.css", themeName));
    }
    //add main CSS file
    if (supportRtl)
    {
        Html.AppendCssFileParts(string.Format("~/Themes/{0}/Content/styles.rtl.css", themeName));
    }
    else
    {
        Html.AppendCssFileParts(string.Format("~/Themes/{0}/Content/styles.css", themeName));
    }
    //responsive design
    if (supportResponsive)
    {
        <meta name="viewport" content="width=device-width, initial-scale=1">
    }
}